﻿SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON

GO


CREATE PROCEDURE [dbo].[bhp_NemoBlogPosts_GetLast](
	@Count	INT,
	@OnlyPublic	BIT = 0,
	@Language	NCHAR(5) = 'pl-PL'
)
AS
BEGIN

	SELECT TOP(@Count)
		* 
	FROM 
		BLOG_POSTS
	WHERE
		(@OnlyPublic = 0 OR published = 1)
		AND del = 0
	ORDER BY ISNULL(publishDate,  dbo.n_DateTimeToDT(ctime)) DESC
		

END
GO
